package com.quectel.sys.module.sys.service.impl.mongo;

import com.quectel.sys.constants.MongoCollectionConstants;
import com.quectel.sys.module.sys.dto.mongo.SmsSendDto;
import com.quectel.sys.module.sys.entity.mongo.SmsSendModel;
import com.quectel.sys.module.sys.service.MsgService;
import com.quectel.util.common.CopyUtils;
import com.quectel.util.kit.Snowflake;
import com.quectel.util.mongo.MongodbUtils;
import org.apache.dubbo.config.annotation.DubboService;

/**
 * @author caolu
 * @email louis.cao@quectel.com
 * @date 2022/01/17 11:31
 */
@DubboService
public class SmsServiceImpl implements MsgService {
    @Override
    public void saveSmsRecord(SmsSendDto smsSendDto) {
        SmsSendModel smsSendModel = CopyUtils.copyObj(smsSendDto, SmsSendModel.class);
        smsSendModel.setId(Snowflake.nextId());
        MongodbUtils.add(smsSendModel, MongoCollectionConstants.SMS_CODE_SEND_RECORD);
    }
}
